// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.16.10
package sys

import (
	"context"
	"hotgo/api/admin/uservideo"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	UserVideo = cUserVideo{}
)

type cUserVideo struct{}

// List 查看用户视频管理列表
func (c *cUserVideo) List(ctx context.Context, req *uservideo.ListReq) (res *uservideo.ListRes, err error) {
	list, totalCount, err := service.SysUserVideo().List(ctx, &req.UserVideoListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.UserVideoListModel{}
	}

	res = new(uservideo.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出用户视频管理列表
func (c *cUserVideo) Export(ctx context.Context, req *uservideo.ExportReq) (res *uservideo.ExportRes, err error) {
	err = service.SysUserVideo().Export(ctx, &req.UserVideoListInp)
	return
}

// Edit 更新用户视频管理
func (c *cUserVideo) Edit(ctx context.Context, req *uservideo.EditReq) (res *uservideo.EditRes, err error) {
	err = service.SysUserVideo().Edit(ctx, &req.UserVideoEditInp)
	return
}

// View 获取指定用户视频管理信息
func (c *cUserVideo) View(ctx context.Context, req *uservideo.ViewReq) (res *uservideo.ViewRes, err error) {
	data, err := service.SysUserVideo().View(ctx, &req.UserVideoViewInp)
	if err != nil {
		return
	}

	res = new(uservideo.ViewRes)
	res.UserVideoViewModel = data
	return
}

// Delete 删除用户视频管理
func (c *cUserVideo) Delete(ctx context.Context, req *uservideo.DeleteReq) (res *uservideo.DeleteRes, err error) {
	err = service.SysUserVideo().Delete(ctx, &req.UserVideoDeleteInp)
	return
}

// Status 更新用户视频管理状态
func (c *cUserVideo) Status(ctx context.Context, req *uservideo.StatusReq) (res *uservideo.StatusRes, err error) {
	err = service.SysUserVideo().Status(ctx, &req.UserVideoStatusInp)
	return
}